#include <stdio.h>

typedef struct date {
    int year;
    int mouth;
    int day;
} Date;

int checkDate ( Date date ) ;

int main ( int argc, char const *argv[] ) {
    Date date;
    int check;
    printf("Please input a date like\t2020 13 32:\n");
    scanf("%d  %d  %d",&date.year, &date.mouth, &date.day);
    check = checkDate(date);
/*output*/
    if ( check == 0 ) {
        printf("Input again!\n");
    } else {
        printf("Well done!\n");
    }
    return 0;
}

/*check*/
int checkDate ( Date date ) {
    int check = 1;
    if ( date.day < 1 || date.day > 31 || date.mouth < 1 ||\
     date.mouth > 12 ) {
         check = 0;
    } else if ( date.mouth == 4\
            ||  date.mouth == 6\
            ||  date.mouth == 9\
            ||  date.mouth == 11
    ) {
        if ( date.day == 31 ) {
            check = 0;
        }
    } else if ( date.mouth == 2 ) {
        if ( ( date.year % 4 == 0 && date.year % 100 != 0 ) || date.year % 400 == 0 ) {
            if ( date.day > 29 ) {
                check = 0;
            }
        } else {
            if ( date.day > 28 ) {
                check = 0;
            }
        }
    }
    return check;
}